#include "stdafx.h"
#include "Ground.h"
#include "BoxComponent.h"


Ground::Ground() : GameObject() {
	m_physicsComponent = new BoxComponent(Ogre::Vector3(0,0,0), Ogre::Vector3(1500,100,1500), 1, false);
	m_physicsComponent->setOffset(Ogre::Vector3(0,50,0));
}

Ground::~Ground() {
}

void Ground::updateLogic() {
}

void Ground::createMovableObject(Ogre::SceneManager* sceneMgr, unsigned int id) {
	//Create ground
	Ogre::Plane plane(Ogre::Vector3::UNIT_Y, 0);
    Ogre::MeshManager::getSingleton().createPlane(
		"ground", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
        plane, 100, 100, 20, 20, true, 1, 5, 5, Ogre::Vector3::UNIT_Z);
	
	//Create a unique name
	std::stringstream out;
	out << "GroundEntity" << id;
	std::string idString = out.str();

    Ogre::Entity* entGround = sceneMgr->createEntity(idString, "ground");

    entGround->setMaterialName("Examples/Rockwall");

	this->addMovableObject(entGround);
	m_node->attachObject(entGround);
}
